﻿using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Media;

namespace bATR.Config
{
	public class bATRConfig
	{
		/// <summary>
		/// When set to true, bATR Caches the rendered images in memory and also generates unique filenames 
		/// in the usercontrol to make sure the cache on the client is not screwing up
		/// default = true
		/// </summary>
		public bool CachingEnabled { get; set; }
		
		/// <summary>
		/// The max nr of images cached by bATR (to avoid heavy memory usage)
		/// default = 100
		/// </summary>
		public int CachedItemsLimit { get; set; }

		/// <summary>
		/// The amount of minutes that the rendered images are stored in cache
		/// default = 300(minutes)
		/// </summary>
		public int CacheExpiration { get; set; }

		/// <summary>
		/// The amount of days images are allowed to be stored on the client (cache control)
		/// default = 7(days)
		/// </summary>
		public int ClientCacheExpiration { get; set; }

		/// <summary>
		/// The path the bATR images should be requested
		/// </summary>
		public string  ImagePath { get; set; }

		/// <summary>
		/// URI to the bATR engine
		/// </summary>
		public Uri EnginePath { get; set; }

		/// <summary>
		/// fonts folder
		/// fixed to this.Enginepath/fonts
		/// </summary>
		public string FontPath { get; set; }

		/// <summary>
		/// Image extension for the rendered images
		/// fixed to .png
		/// </summary>
		public string ImageExtension { get; set; }

		/// <summary>
		/// Creates HTML comment about bATR in output
		/// </summary>
		public bool EnablebATRHeaderInfo { get; set; }

		/// <summary>
		/// Hides the images and shows the HTML tags on print
		/// </summary>
		public bool ReplaceImagesOnPrint { get; set; }

		/// <summary>
		/// List of themes
		/// </summary>
		public List<bATRTheme> Themes { get; set; }


		/// <summary>
		/// Admin settings
		/// </summary>
		public bATRAdmin Admin { get; set; }

		/// <summary>
		/// The key where the cached items can be found
		/// </summary>
		public static string CachedItemsCacheKey
		{
			get
			{
				return "bATRCachedObjects";
			}
		}

	}


	public class bATRAdmin
	{
		public string Username { get; set; }
		public string Password { get; set; }
	}

	public class bATRTheme
	{
		public string Name { get; set; }

		public List<bATRStyle> Styles { get; set; }
	}


	public class bATRStyle
	{
		public string Name { get; set; }

		public string FontName { get; set; }

		public string HeaderHtmlTag { get; set; }

		public FontStyle FontStyle { get; set; }

		public FontWeight FontWeight { get; set; }

		public FontStretch FontStretch { get; set; }

		public double FontSize { get; set; }

		public double LineHeight { get; set; }

		public double CharacterSpacing { get; set; }

		public double CharacterSpacingSpaceSize { get; set; }

		public Color FontColor { get; set; }

		public Color BackgroundColor { get; set; }

		public Point TextStartPoint { get; set; }

		public string InlineImage { get; set; }

		public Rect InlineImageRect { get; set; }

		public bool TextToUpper { get; set; }

		public bool TextToLower { get; set; }

		public int RenderedImageWidth { get; set; }

		public int RenderedImageHeight { get; set; }

		public Color? GradientColor { get; set;}

		public double? GradientAngle { get; set; }

		public bool HasTextDecorationPen { get; set; }

		public Pen TextDecorationPen { get; set; }

		public double TextDecorationPenOffset { get; set; }

		public TextDecorationLocation TextDecorationLocation { get; set; }
	}
}
